Desktop directory is not translated. (set_tree_model): There might not be
authorAlexander Larsson <alexl@redhat.com>
Fri, 20 Feb 2004 07:52:56 +0000 (07:52 +0000)
committerAlexander Larsson <alexl@src.gnome.org>
Fri, 20 Feb 2004 07:52:56 +0000 (07:52 +0000)
2004-02-20  Alexander Larsson  <alexl@redhat.com>

* gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop):
Desktop directory is not translated.
(set_tree_model):
There might not be volumes for all paths.
* gtk/gtkfilechooserwidget.c:
(gtk_file_chooser_widget_constructor):
Use gtk_file_chooser_set_current_folder to set cwd.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c
gtk/gtkfilechooserwidget.c

index b871701bc33c686834a4f030f68a42c37ec7b239..74a305ac96bf984693737b1f1e9cf5421bb9f6d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-02-20  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop):
+       Desktop directory is not translated.
+       (set_tree_model):
+       There might not be volumes for all paths.
+       * gtk/gtkfilechooserwidget.c:
+       (gtk_file_chooser_widget_constructor):
+       Use gtk_file_chooser_set_current_folder to set cwd.
+
 Thu Feb 19 19:58:53 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.[ch]: New widget to handle the path in the
index b871701bc33c686834a4f030f68a42c37ec7b239..74a305ac96bf984693737b1f1e9cf5421bb9f6d3 100644 (file)
@@ -1,3 +1,13 @@
+2004-02-20  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop):
+       Desktop directory is not translated.
+       (set_tree_model):
+       There might not be volumes for all paths.
+       * gtk/gtkfilechooserwidget.c:
+       (gtk_file_chooser_widget_constructor):
+       Use gtk_file_chooser_set_current_folder to set cwd.
+
 Thu Feb 19 19:58:53 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.[ch]: New widget to handle the path in the
index b871701bc33c686834a4f030f68a42c37ec7b239..74a305ac96bf984693737b1f1e9cf5421bb9f6d3 100644 (file)
@@ -1,3 +1,13 @@
+2004-02-20  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop):
+       Desktop directory is not translated.
+       (set_tree_model):
+       There might not be volumes for all paths.
+       * gtk/gtkfilechooserwidget.c:
+       (gtk_file_chooser_widget_constructor):
+       Use gtk_file_chooser_set_current_folder to set cwd.
+
 Thu Feb 19 19:58:53 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.[ch]: New widget to handle the path in the
index b871701bc33c686834a4f030f68a42c37ec7b239..74a305ac96bf984693737b1f1e9cf5421bb9f6d3 100644 (file)
@@ -1,3 +1,13 @@
+2004-02-20  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop):
+       Desktop directory is not translated.
+       (set_tree_model):
+       There might not be volumes for all paths.
+       * gtk/gtkfilechooserwidget.c:
+       (gtk_file_chooser_widget_constructor):
+       Use gtk_file_chooser_set_current_folder to set cwd.
+
 Thu Feb 19 19:58:53 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.[ch]: New widget to handle the path in the
index b871701bc33c686834a4f030f68a42c37ec7b239..74a305ac96bf984693737b1f1e9cf5421bb9f6d3 100644 (file)
@@ -1,3 +1,13 @@
+2004-02-20  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop):
+       Desktop directory is not translated.
+       (set_tree_model):
+       There might not be volumes for all paths.
+       * gtk/gtkfilechooserwidget.c:
+       (gtk_file_chooser_widget_constructor):
+       Use gtk_file_chooser_set_current_folder to set cwd.
+
 Thu Feb 19 19:58:53 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkpathbar.[ch]: New widget to handle the path in the
index 50ac4eb97812430bd88d7e4260a490b8ac6aeb0c..cee3e6b0fc033dab658b76841be4842875188248 100644 (file)
@@ -649,9 +649,7 @@ shortcuts_append_desktop (GtkFileChooserDefault *impl)
   char *name;
   GtkFilePath *path;
 
-  /* FIXME: What is the Right Way of finding the desktop directory? */
-
-  name = g_build_filename (g_get_home_dir (), _("Desktop"), NULL);
+  name = g_build_filename (g_get_home_dir (), "Desktop", NULL);
   path = gtk_file_system_filename_to_path (impl->file_system, name);
   g_free (name);
 
@@ -2127,18 +2125,36 @@ static void
 set_tree_model (GtkFileChooserDefault *impl, const GtkFilePath *path)
 {
   GtkFileSystemVolume *volume;
-  GtkFilePath *volume_path;
+  GtkFilePath *base_path, *parent_path;
 
+  base_path = NULL;
+  
   volume = gtk_file_system_get_volume_for_path (impl->file_system, path);
-  volume_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
+  
+  if (volume)
+    base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
+  
+  if (base_path == NULL)
+    {
+      base_path = gtk_file_path_copy (path);
+      while (gtk_file_system_get_parent (impl->file_system,
+                                        base_path,
+                                        &parent_path,
+                                        NULL) &&
+            parent_path != NULL)
+       {
+         gtk_file_path_free (base_path);
+         base_path = parent_path;
+       }
+    }
 
-  if (impl->current_volume_path && gtk_file_path_compare (volume_path, impl->current_volume_path) == 0)
+  if (impl->current_volume_path && gtk_file_path_compare (base_path, impl->current_volume_path) == 0)
     goto out;
 
   if (impl->tree_model)
     g_object_unref (impl->tree_model);
 
-  impl->current_volume_path = gtk_file_path_copy (volume_path);
+  impl->current_volume_path = gtk_file_path_copy (base_path);
 
   impl->tree_model = _gtk_file_system_model_new (impl->file_system, impl->current_volume_path, -1,
                                                 GTK_FILE_INFO_DISPLAY_NAME);
@@ -2150,8 +2166,9 @@ set_tree_model (GtkFileChooserDefault *impl, const GtkFilePath *path)
 
  out:
 
-  gtk_file_path_free (volume_path);
-  gtk_file_system_volume_free (impl->file_system, volume);
+  gtk_file_path_free (base_path);
+  if (volume) 
+    gtk_file_system_volume_free (impl->file_system, volume);
 }
 
 static void
index 2e9d3bef4d3e46a2264a5e2b7db1096963399934..41bf628674cb0856166e6193a43e8da1f8791aa0 100644 (file)
@@ -144,12 +144,7 @@ gtk_file_chooser_widget_constructor (GType                  type,
   gtk_widget_show (priv->impl);
 
   current_folder = g_get_current_dir ();
-  current_folder_uri = g_filename_to_uri (current_folder, NULL, NULL);
-  if (current_folder_uri)
-    {
-      gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (priv->impl), current_folder_uri);
-      g_free (current_folder_uri);
-    }
+  gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (priv->impl), current_folder);
   g_free (current_folder);
   
   _gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object),